#!/bin/sh
interval=5 # set the interval to obtain the memory information
app_name='com.example.navigationdemo' # the app name which to check
app_pid=`pidof $app_name`
nativeleak=./nativememleak.log
arktsleak=./arktsmemleak.log
mount -o rw,remount /
echo "" > $nativeleak
echo "" > $arktsleak
echo "the name and pid of the checked app are: [$app_name, $app_pid]."
while true; do
    # hidumper --mem $app_pid | grep ark >> $arktsleak
    # hidumper --mem $app_pid | grep native >> $nativeleak
    hidumper --mem $app_pid | grep ark | tee -a $arktsleak
    hidumper --mem $app_pid | grep native | tee -a $nativeleak
    sleep $interval
done
